Meta-programming Tools for Ml

نویسنده

  • Tim Sheard
چکیده

Compile-time reeective ML (CRML) is an extension to Standard ML providing a metalanguage for program manipulationn10]. The original motivation was the automatic generation of map and fold like combinators for arbitrary datatypess4, 9]. The mechanisms developed to achieve this are far more general than we at rst realized, providing the foundation for a rich class of language extensions expressed as source to source translations. Any programming task where the construction of a program can be described by an algorithm can be captured directly and naturally in CRML. In such a paradigm the object language (the language of the constructed programs) and the meta language (the language in which the algorithm is expressed) can be two distinct languages. In CRML both these languages are ML. The object language is encoded in data structures which are predeened by the system. CRML supplies a user level interface (syntactic sugar) so that the object language programs look like the programs they represent. It is the right language for expressing programs that manipulate programs. We have used CRML to implement \just plain macros", ML language processors, and experimental ML language extensionss2, 3]. An example, described later, is the extension of ML to support attribute grammar computations over ML datatypes. The class of ML extensions that can be rapidly prototyped with CRML is limited only by your imagination. The meta-programming paradigm supported by CRML supplies more than just macro-like transformations. CRML can be used to generate programs that require semantic as well as syntactic information, and to encode new abstractions not possible in ordinary functional languages. CRML is implemented as an extension to the Standard ML of New Jersey compilerr1]. Like the original ML and its French cousins, CRML uses an \object-language" facility to support reeection. Unlike these other tools, however, the object-language is just another instance of CRML (the metalanguage). There is a distinguished set of datatypes, including pat, exp and typ, that encode the abstract syntax of the object-language. CRML uses \object brackets" (written << >>) to construct object-language expressions with an embedded parser. Object-language expressions can escape to the metalanguage with an escape (written`), similar to the anti-quotation (,) in LISP. Most meta-programming can be accomplished using only the object bracket notation; detailed knowledge of the distinguished datatypes is often unnecessary. An example use of the object-language escape mechanism is: let val five = <<5>> in <> end. This could be …

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Standard ML as a Meta-Programming Language

Meta-programming languages, or program generators, are languages whose programs produce programs in other languages. We show how Standard ML makes an excellent meta-programming language, by adding appropriate program-valued | by which we mean string-valued | operations for each domain. We do so by giving four examples of meta-programming languages: a top-down parser generator; a \geometric regi...

متن کامل

Extending Old Compiler Tools with Meta-Tools

There are many tradeoffs involved in choosing between a new, more powerful software tool and an older, more established one. The best way to handle this problem may be to make the old tool more powerful through the use of meta-tools. Compiler tools suffer from this exact problem – we present YETI, a meta-tool that provides a framework for transforming and enhancing Yacc specifications. YETI can...

متن کامل

Weighing and Prioritizing Branding Components of Tourism Objectives by Combining Meta synthesis Approach and Logistic Fuzzy Programming Preferences

The destination of tourism is a major element in tourism marketing. Branding tourism destination is a process by which a tourism destination develops its focal features, develops and delivers its main audience, can build a reputation, establish its reputation, strengthen slowly or even change, which is important for tourism purposes. Brand recognition is very important for communicating success...

متن کامل

System Description: Twelf - A Meta-Logical Framework for Deductive Systems

Twelf is a meta-logical framework for the specification, implementation, and meta-theory of deductive systems from the theory of programming languages and logics. It relies on the LF type theory and the judgments-as-types methodology for specification [HHP93], a constraint logic programming interpreter for implementation [Pfe91], and the meta-logic M2 for reasoning about object languages encode...

متن کامل

Functional programming languages for verification tools: experiences with ML and Haskell

We compare Haskell with ML as programming languages for verification tools, based on our experience developing TRUTH in Haskell and the Edinburgh Concurrency Workbench (CWB) in ML. We discuss not only technical language features but also the “worlds” of the languages, for example, the availability of tools and libraries.

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1994